﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Didsoft.Mvc.DataModel.Lites;
using Boa.AIT.Negocios;

namespace Boa.AIT.Web.Controllers
{
    public class PersonalBoaController : Controller
    {
        //
        // GET: /PersonalBoa/

        public ActionResult Index()
        {
            return View();
        }


        /// <summary>
        /// este metodo deberia retornar los empleados de acuerdo a la region geografica del almacen.
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public JsonResult JSONGetEmpleadosBoa()
        {
            try
            {
                List<KeyValueLite> datas = new List<KeyValueLite>();
                
                    BOAPersonalNegocios empleadosNegocios = new BOAPersonalNegocios();
                    datas = empleadosNegocios.GetTodoPersonalBoa().Select(c => new
                    KeyValueLite
                    {
                        DisplayText = c.NombreCompleto,
                        Value = c.EmpleadoId.ToString()
                    }).ToList();
               
                return Json(new { Result = "OK", Options = datas });
            }
            catch (Exception ex)
            {
                return Json(new { Result = "ERROR", Message = ex.Message });
            }
        }

    }
}
